package com.apes.scm.masterdata.party.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.area.model.Area;
import com.apes.scm.masterdata.area.model.Country;
import com.apes.scm.masterdata.stock.model.PhyDepot;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：供应商送达仓库
 *
 * @author Linwz
 * @create 2020-2-13 11:23
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = SupplierReachItem.CONST_TABLE_NAME)
public class SupplierReachItem extends BaseModel {
    public static final String CONST_TABLE_NAME = "mas_supplier_reach_item";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "供应商送达仓库编码")
    @Comment("唯一码")
    private String id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "supplier_logistic_id", referencedColumnName = "id", nullable = false)
    @Comment("供应商物流扩展表")
    private SupplierLogistic supplierLogistic;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "phy_depot_id", referencedColumnName = "id", nullable = false)
    @Comment("物理仓")
    private PhyDepot phyDepot;

}
